home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
tex
/
cm_mf.arc
/
CMBASE.MF
< prev
next >
Wrap
Text File
|
1989-01-30
|
29KB
|
689 lines
% The base file for Computer Modern (a supplement to {\tt plain.mf})
cmbase:=1; % when |cmbase| is known, this file has been input
let cmchar=\; % `|cmchar|' should precede each character
let generate=input; % `|generate|' should follow the parameters
autorounding:=0; smoothing:=0; % we do our own rounding
def autorounded = interim autorounding:=2 enddef;
newinternal slant,fudge,math_spread,superness,superpull,beak_darkness,ligs;
boolean square_dots,hefty,serifs,
monospace,variant_g,low_asterisk,math_fitting;
boolean dark,dark.dark,skewed,skewed.skewed; % for fast option testing
dark=skewed=false; dark.dark=skewed.skewed=true;
vardef Vround primary y = y_:=vround y;
if y_<min_Vround: min_Vround else: y_ fi enddef;
newinternal y_,min_Vround;
vardef serif(suffix $,$$,@) % serif at |z$| for stroke from |z$$|
(expr darkness,jut) suffix modifier =
pickup crisp.nib; numeric bracket_height; pair downward;
bracket_height=if dark.modifier: 1.5 fi\\ bracket;
if y$<y$$: y@2=min(y$+bracket_height,y$$);
top y@1-slab=bot y@0+eps=tiny.bot y$; downward=z$-z$$;
if y@1>y@2: y@2:=y@1; fi
else: y@2=max(y$-bracket_height,y$$);
bot y@1+slab=top y@0-eps=tiny.top y$; downward=z$$-z$;
if y@1<y@2: y@2:=y@1; fi fi
y@3=y@2; z@3=whatever[z$,z$$];
if jut<0: z@2+penoffset downward of currentpen =
z$l+penoffset downward of pen_[tiny.nib]+whatever*downward;
lft x@0=lft x@1=tiny.lft x$l+jut;
if x@3<x@2+eps: x@3:=x@2+eps; fi
else: z@2-penoffset downward of currentpen =
z$r-penoffset downward of pen_[tiny.nib]+whatever*downward;
rt x@0=rt x@1=tiny.rt x$r+jut;
if x@3>x@2-eps: x@3:=x@2-eps; fi fi
pair corner; ypart corner=y@1; corner=z@2+whatever*downward;
filldraw z@2{z$-z$$}
...darkness[corner,.5[z@1,z@2] ]{z@1-z@2}
...{jut,0}z@1--z@0--(x$,y@0)--z@3--cycle; % the serif
labels (@1,@2); enddef;
def dish_serif(suffix $,$$,@)(expr left_darkness,left_jut)
(suffix @@)(expr right_darkness,right_jut) suffix modifier =
serif($,$$,@,left_darkness,-left_jut) modifier;
serif($,$$,@@,right_darkness,right_jut) modifier;
if dish>0: pickup tiny.nib; numeric dish_out,dish_in;
if y$<y$$: dish_out=bot y$; dish_in=dish_out+dish; let rev_=reverse;
else: dish_out=top y$; dish_in=dish_out-dish; let rev_=relax; fi
erase fill rev_
((x@1,dish_out)..(x$,dish_in){right}..(x@@1,dish_out)--cycle);
fi enddef;
def nodish_serif(suffix $,$$,@)(expr left_darkness,left_jut)
(suffix @@)(expr right_darkness,right_jut) suffix modifier =
serif($,$$,@,left_darkness,-left_jut) modifier;
serif($,$$,@@,right_darkness,right_jut) modifier; enddef;
vardef sloped_serif.l(suffix $,$$,@)(expr darkness,jut,drop) =
pickup crisp.nib; pos@2(slab,90);
lft x@0=tiny.lft x$l; rt x@1=tiny.rt x$r; top y@1=tiny.top y$r;
lft x@2=lft x@0-jut; y@2r=y@1-drop;
y@0=max(y@2l-bracket,y$$)-eps;
if drop>0: erase fill z@1--top z@1
--(x@2r,top y@1)--z@2r--cycle; fi % erase excess at top
filldraw z@1--z@2r--z@2l{right}
...darkness[(x@0,y@2l),.5[z@2l,z@0] ]{z@0-z@2l}
...{down}z@0--(x@1,y@0)--cycle; % sloped serif
labels(@0,@1,@2); enddef;
vardef sloped_serif.r(suffix $,$$,@)(expr darkness,jut,drop) =
pickup crisp.nib; pos@2(slab,-90);
rt x@0=tiny.rt x$r; lft x@1=tiny.lft x$l; bot y@1=tiny.bot y$l;
rt x@2=rt x@0+jut; y@2r=y@1+drop;
y@0=min(y@2l+bracket,y$$)+eps;
if drop>0: erase fill z@1--bot z@1
--(x@2r,bot y@1)--z@2r--cycle; fi % erase excess at bottom
filldraw z@1--z@2r--z@2l{left}
...darkness[(x@0,y@2l),.5[z@2l,z@0] ]{z@0-z@2l}
...{up}z@0--(x@1,y@0)--cycle; % sloped serif
labels(@0,@1,@2); enddef;
vardef term.l(suffix $,$$)(expr d,t,s)= % ``robust'' sans-serif terminal
path p_; p_=z$l{d}..tension t..z$$l;
pair d_; d_=(x$$l-x$l,s*(y$$l-y$l));
if (abs angle direction 1 of p_ < abs angle d_)<>(x$l<x$$l):
p_:=z$l{d}..tension atleast t..{d_}z$$l; fi
p_ enddef;
vardef term.r(suffix $,$$)(expr d,t,s)=
path p_; p_=z$r{d}..tension t..z$$r;
pair d_; d_=(x$$r-x$r,s*(y$$r-y$r));
if (abs angle direction 1 of p_ < abs angle d_)<>(x$r<x$$r):
p_:=z$r{d}..tension atleast t..{d_}z$$r; fi
p_ enddef;
def rterm=reverse term enddef;
vardef arm(suffix $,$$,@)(expr darkness,jut) = % arm from |z$| to |z$$|
x@0=good.x(x$$r-jut); y@0=y$r;
if serifs: y@1=y$l; z@1=z$$l+whatever*(z$$r-z@0);
z@2=.5[z$l,z@1];
filldraw z$$l{z@1-z$$l}...darkness[z@1,.5[z@2,z$$l] ]...z@2
---z$l--z$r--z@0--z$$r--cycle; % arm and beak
else: filldraw z$l--z$r--z@0--z$$r--cycle; fi % sans-serif arm
penlabels(@0,@1,@2); enddef;
def pi_stroke = pickup fine.nib;
pos1(hair,0); pos2(vstem,-90); pos3(vstem,-90);
x1-.5hair=hround -.5hair; x2=2u; x3=w-1.5u;
y1=x_height-x_height/3.141592653589793; y2=y3; top y3l=x_height;
filldraw circ_stroke z3e---z2e...{x1-x2,3.14159(y1-y2)}z1e enddef;
def bulb(suffix $,$$,$$$) =
z$$$r=z$$r;
path_.l:=z$l{x$$r-x$r,0}...{0,y$$r-y$r}z$$l;
filldraw path_.l--z$$r{0,y$r-y$$r}...{x$r-x$$r,0}z$r--cycle; % link
path_.r:=z$$$l{0,y$r-y$$r}..z$$$r{0,y$$r-y$r}; % near-circle
filldraw subpath(0,xpart(path_.r intersectiontimes path_.l)) of path_.r
--z$$r{0,y$$r-y$r}..cycle; % bulb
enddef;
def v_bulb(suffix $,$$)= % |pos$| is known
y$$+.5curve=x_height+oo; x$$+.5curve=w-u;
numeric theta; theta=angle(4(x$-x$$),y$-y$$); pos$$(curve,theta+90);
filldraw z$$l{dir theta}..tension atleast 1 and 1..{down}z$l
--z$r{up}...{-dir theta}z$$r..cycle; % bulb
enddef;
def dot(suffix $,$$) =
filldraw if square_dots: (x$l,y$$l)--(x$r,y$$l)
--(x$r,y$$r)--(x$l,y$$r)--cycle % squarish dot
else: z$l...z$$l...z$r...z$$r...cycle fi % roundish dot
enddef;
def comma(suffix $,@)(expr dot_size,jut,depth) =
pickup fine.nib; pos$(dot_size,90);
if square_dots: pos$'(dot_size,0); z$'=z$; dot($',$); % squarish dot
comma_join_:=max(fine.breadth,floor .7dot_size);
comma_bot_:=max(fine.breadth,floor .5dot_size);
pos@0(comma_join_,0); pos@1(comma_join_,0);
pos@2(comma_bot_,0); y@0=y$; y@1=y$l; y@2=y@1-depth;
x@0r=x@1r=x$'r; rt x@2r=good.x(x$-eps);
filldraw stroke z@0e--z@1e..z@2e; % tail
else: pos@1(vair,90); pos@2(vair,0); pos@3(vair,-45);
z@1r=z$r; rt x@2r=hround(x$+.5dot_size+jut)+2eps; x@3=x$-.5u;
y@2=1/3[y@1,y@3]; bot y@3r=vround(y$-.5dot_size-depth);
y_:=ypart((z@1{right}...z@2{down}...z@3)
intersectiontimes (z$l{right}..{left}z$r)); if y_<0: y_:=1; fi
filldraw z$r{left}..subpath (0,y_) of (z$l{right}..{left}z$r)--cycle; % dot
filldraw stroke z@1e{right}...z@2e{down}...z@3e; fi % tail
penlabels(@1,@2,@3); enddef;
def ammoc(suffix $,@)(expr dot_size,jut,depth) = % reversed comma
pickup fine.nib; pos$(dot_size,90);
if square_dots: pos$'(dot_size,0); z$'=z$; dot($',$); % squarish dot
comma_join_:=max(fine.breadth,floor .7dot_size);
comma_top_:=max(fine.breadth,floor .5dot_size);
pos@0(comma_join_,0); pos@1(comma_join_,0);
pos@2(comma_top_,0); y@0=y$; y@1=y$r; y@2=y@1+depth;
x@0l=x@1l=x$'l; lft x@2l=good.x(x$+eps);
filldraw stroke z@0e--z@1e..z@2e; % tail
else: pos@1(vair,90); pos@2(vair,0); pos@3(vair,-45);
z@1l=z$l; lft x@2l=hround(x$-.5dot_size-jut)-2eps; x@3=x$+.5u;
y@2=1/3[y@1,y@3]; top y@3l=vround(y$+.5dot_size+depth);
y_:=ypart((z@1{left}...z@2{up}...z@3)
intersectiontimes (z$r{left}..{right}z$l)); if y_<0: y_:=1; fi
filldraw z$l{right}..subpath (0,y_) of (z$r{left}..{right}z$l)--cycle; % dot
filldraw stroke z@1e{left}...z@2e{up}...z@3e; fi % tail
penlabels(@1,@2,@3); enddef;
%%% @ from to %%%% temporary formatting change
vardef diag_in(suffix from,$)(expr sharpness)(suffix $$) =
pickup tiny.nib; save from_x,y_;
if y.from>y$: bot else: top fi\\ y_=y$;
(from_x,y_)=whatever[z.from,z$];
sharpness[z$,(from_x,y_)]{z$-z.from}
...{z$$-z$}z$+sharpness*length(z$-(from_x,y_))*unitvector(z$$-z$) enddef;
vardef diag_out(suffix $)(expr sharpness)(suffix $$,to) =
pickup tiny.nib; save to_x,y_;
if y.to>y$: bot else: top fi\\ y_=y$;
(to_x,y_)=whatever[z$$,z.to];
z$$-sharpness*length(z$$-(to_x,y_))*unitvector(z$$-z$){z$$-z$}
...{z.to-z$$}sharpness[z$$,(to_x,y_)] enddef;
vardef diag_end(suffix from,$)(expr sharp